import { Response } from "express";
export class ResponseUtil {
  // 返回成功
  static success(res: Response, data: any = null, message = "成功", code = 0) {
    return res.json({ code, message, data });
  }
  // 返回失败
  static error(res: Response, data: any = null, message = "失败", code = -1) {
    return res.status(400).json({ code, message, data });
  }
}
